import api from '@/api/index'
import { userService } from '@/utils/apiConfig'
// 分页查询信息
export const getRoleList = <T>(data?: unknown) => {
  return api.get<T>(userService + '/roles', data)
}
// 不分页查询角色
export const getRoleAllList = <T>(data?: unknown) => {
  return api.get<T>(userService + '/roles/list', data)
}
// 修改角色
export const editSubmit = <T>(id: string, data?: unknown) => {
  return api.put<T>(userService + '/roles/' + id + '/menuList:update', data)
}
// 修改角色人员
export const editUserSubmit = <T>(id: string, data?: unknown) => {
  return api.put<T>(userService + '/roles/' + id + '/userList:update', data)
}
// 新增角色
export const addSubmit = <T>(data?: unknown) => {
  return api.post<T>(userService + '/roles', data)
}
// 校验角色名称重复
export const validateNameExist = <T>(data?: unknown) => {
  return api.post<T>(userService + '/roles/nameRepeat:check', data)
}
// 获取角色详情
export const getRoleDetailById = <T>(id: string) => {
  return api.get<T>(userService + '/roles/' + id)
}
// 删除角色
export const deleteRole = <T>(id: string, data?: unknown) => {
  return api.delete<T>(userService + '/roles/' + id, data)
}
